#include <map>
#include <iostream>
#include <string>
struct Stat
{
    Stat():sum_(0.0),count_(0)
        {
        }
    double sum_;
    int count_;
};
using std::string;
using std::cin;
using std::cout;
using std::endl;
typedef std::map<string,Stat> Data;
typedef Data::iterator pData;

void collect_data(Data &stats)
{
    string name;
    while(cin >> name)
    {
        if( name == "Quit")
        {
            return ;
        }
        float value;
        cin >> value;
        stats[name].sum_ += value;
        ++stats[name].count_;
    }
    
}
void print_data(const Data& stats)//this is a const object
{
    double sum = 0;
    int count = 0;
    for(Data::const_iterator p = stats.begin(); p != stats.end(); ++p)
    {
        std::cout << (*p).first
                  << " sum =" <<(*p).second.sum_
                  << ", mean = "
                  <<(*p).second.sum_/(*p).second.count_
                  << endl;
        sum += p->second.sum_;
        count += p->second.count_;
    }
    cout << endl;
    cout << " Globle sum: " << sum << endl;
    cout << " Globle count: " << count << endl;
}
int main()
{
    Data stats;
    collect_data(stats);
    print_data(stats);
    return 0;
}

        
        
